package db.pojo;

import java.util.*;
import java.text.SimpleDateFormat;
import db.ext.EaexceptionExt;
@SuppressWarnings("unchecked")
/**
 * eaexception
 */
public class Eaexception {
	/**
	 * EXCEPTIONID
	 */
	public String eXCEPTIONID;
	/**
	 * CLAZZ
	 */
	public String cLAZZ;
	/**
	 * METHODNAME
	 */
	public String mETHODNAME;
	/**
	 * ACTIVETIME
	 */
	public long aCTIVETIME;
	/**
	 * EXCEPTION
	 */
	public String eXCEPTION;
	SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
	public static EaexceptionExt DB = new EaexceptionExt(); 
	
	public Eaexception() {
		super();
	}
	
	public Eaexception(String eXCEPTIONID, String cLAZZ, String mETHODNAME, long aCTIVETIME, String eXCEPTION) {
		super();
		this.eXCEPTIONID = eXCEPTIONID; 
		this.cLAZZ = cLAZZ; 
		this.mETHODNAME = mETHODNAME; 
		this.aCTIVETIME = aCTIVETIME; 
		this.eXCEPTION = eXCEPTION; 
	}
	
	public String getEXCEPTIONID() {
		return eXCEPTIONID;
	}

	public void setEXCEPTIONID(String eXCEPTIONID) {
		this.eXCEPTIONID = eXCEPTIONID;
	} 
	
	public String getCLAZZ() {
		return cLAZZ;
	}

	public void setCLAZZ(String cLAZZ) {
		this.cLAZZ = cLAZZ;
	} 
	
	public String getMETHODNAME() {
		return mETHODNAME;
	}

	public void setMETHODNAME(String mETHODNAME) {
		this.mETHODNAME = mETHODNAME;
	} 
	
	public long getACTIVETIME() {
		return aCTIVETIME;
	}

	public void setACTIVETIME(long aCTIVETIME) {
		this.aCTIVETIME = aCTIVETIME;
	} 
	
	public void changeACTIVETIMEWith(long aCTIVETIME){
		this.aCTIVETIME += aCTIVETIME;
	}
	
	public void changeACTIVETIMEWithMin(long aCTIVETIME,long min){
		this.aCTIVETIME += aCTIVETIME;
		this.aCTIVETIME = this.aCTIVETIME < min ? min : this.aCTIVETIME;
	}
	
	public void changeACTIVETIMEWithMax(long aCTIVETIME,long max){
		this.aCTIVETIME += aCTIVETIME;
		this.aCTIVETIME = this.aCTIVETIME > max ? max : this.aCTIVETIME;
	}
	
	public void changeACTIVETIMEWithMaxMin(long aCTIVETIME,long max,long min){
		this.aCTIVETIME += aCTIVETIME;
		this.aCTIVETIME = this.aCTIVETIME < min ? min : this.aCTIVETIME;
		this.aCTIVETIME = this.aCTIVETIME > max ? max : this.aCTIVETIME;
	}	
	public String getEXCEPTION() {
		return eXCEPTION;
	}

	public void setEXCEPTION(String eXCEPTION) {
		this.eXCEPTION = eXCEPTION;
	} 
	
	
	public Map eaexceptionToMap() {
		Map map = new HashMap();
		try {
			map.put("eXCEPTIONID",this.eXCEPTIONID);
			map.put("cLAZZ",this.cLAZZ);
			map.put("mETHODNAME",this.mETHODNAME);
			map.put("aCTIVETIME",this.aCTIVETIME);
			map.put("eXCEPTION",this.eXCEPTION);
		} catch (Exception e) {
			e.printStackTrace();
		}
		return map;
	}

	public Eaexception mapToEaexception(Map map){
		try {
			String eXCEPTIONID =  map.get("eXCEPTIONID").toString();
			String cLAZZ =  map.get("cLAZZ").toString();
			String mETHODNAME =  map.get("mETHODNAME").toString();
			long aCTIVETIME = Long.parseLong( map.get("aCTIVETIME").toString());
			String eXCEPTION =  map.get("eXCEPTION").toString();
			Eaexception eaexception = new Eaexception(eXCEPTIONID, cLAZZ, mETHODNAME, aCTIVETIME, eXCEPTION);
			return eaexception;
		} catch (Exception e) {
			e.printStackTrace();
			return null;
		}
	} 
	
	public String toString(){
		return eaexceptionToMap().toString();
	}
	
	//方便数据操作	
	public Eaexception insert(){
		return DB.insert(this);
	}
	public Eaexception update(){
		return DB.update(this);
	}
	
	public int delete(){
		return DB.delete(this);
	}
	
}
